package com.inei.cie.utilitarios;

import java.util.ArrayList;
import java.util.List;

import com.inei.cie.R;
import com.inei.cie.entidades.P1_B_2A_N;
import com.inei.cie.utilitarios.ListadoInstitucionesAdapter.ViewHolder;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListadoPrediosRuralAdapter extends BaseAdapter {
	Context context;
	int cantidadPredios;
	public ArrayList<String> listaPredios;

	public ListadoPrediosRuralAdapter(Context context, int cantidadPredios, ArrayList<String> listaPredios) {
		this.context = context;
		this.listaPredios = listaPredios;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return listaPredios.size();
	}

	@Override
	public Object getItem(int pos) {
		return listaPredios.get(pos);
	}

	@Override
	public long getItemId(int pos) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int pos, View view, ViewGroup grupo) {
		// TODO Auto-generated method stub
		View item = view;
		ViewHolder holder;
		if (item == null) {
			LayoutInflater inflater = (LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			item = inflater.inflate(R.layout.item_lista_rural, null);
			holder = new ViewHolder();
			holder.tvItem = (TextView) item.findViewById(R.id.tvItem);
			item.setTag(holder);
		} else {
			holder = (ViewHolder) item.getTag();
		}
		holder.tvItem.setText("Predio Nro " + listaPredios.get(pos));
		return item;
	}

	class ViewHolder {
		TextView tvItem;
	}

}
